/*! 
\file 
	UserDataTypeInfo.h
\brief
	Declaration of UserDataTypeInfo.
\details
\bug
	none
\todo
	none
\date
	February 1, 2008 - first version of the file.
	April 20, 2008 - added support of basic class.
\author
	Copyright (C) 2008 Vadym Hulakov, mailto:hulakov@gmail.com. All rights reserved.
*/

#ifndef USERDATATYPEINFO_H
#define USERDATATYPEINFO_H

#include <vector>
#include <string>

#include "Type.h"
#include "Variable.h"
#include "Method.h"

namespace ObjectModel
{
	//! Class that represents user data type.
	class ClassType : public Type
	{
	private:
		friend class TypeHierarchy;

		//! @name Construction and destruction
		//@{
		//! Constructor.
		//! @param [in] name
		//!		Name of the data type.
		//! @param [in] description
		//!		Description of the data type.
		ClassType(const wchar_t* name, const TypeHierarchy& manager, 
			const wchar_t* description = 0);
		//@}

	public:
		//! @name Overloads
		virtual int getSize() const;
		virtual bool isBasic() const 
		{
			return false;
		}
		//@}

	public:

		//! @name Work with attributes
		//@{

		typedef std::vector<Attribute> Attributes;

		//! Get all attributes of type.
		const Attributes& getAttributes() const
		{
			return _attributes;
		}
		
		//! Add attribute.
		Attribute& addAttribute(const wchar_t* name, Type& type, 
			ClassMemberAccess access = ClassMemberAccessPrivate,
			const wchar_t* description = 0);
		
		typedef std::vector<Method> Methods;

		//! Get all methods of type.
		const Methods& getMethods() const
		{
			return _methods;
		}

		//! Add method.
		Method& addMethod(const wchar_t* name,
			const Type& return_type,
			bool isPure,
			ClassMemberAccess access = ClassMemberAccessPublic,
			const wchar_t* description = 0);

		//@}
		
		//! Get basic class for this user data type.
		//! @return
		//!		Pointer to basic class or 0 if class does not
		//!		have basic class.
		const ClassType* basicClass() const 
		{
			return _basicClass;
		}

		void setBasicClass(ClassType* basicClass)
		{
			_basicClass = basicClass;
		}

	private:
		Attributes _attributes;
		Methods _methods;
		ClassType* _basicClass;
	};
}
#endif // USERDATATYPEINFO_H